function addStudent() {
    // 获取班级
    let clazz = document.getElementById("class").value;
    // 获取name
    let name = document.getElementById("name").value;;
    // 获取性别
    let gender;
    let sex = document.getElementsByName("sex");
    if (sex[0].checked == true) {
        gender = "男"
    } else {
        gender = "女"
    }
    // 获取年龄
    let age = document.getElementById("age").value;
    // 获取爱好
    let hobby = [];
    let aihao = document.getElementsByName("aihao");
    for (let i = 0; i < aihao.length; i++) {
        if (aihao[i].checked == true) {
            hobby.push(aihao[i].value);
        }
    }
    // 获取手机号
    let tel = document.getElementById("tel").value;
    // 获取地址
    let optionlist = document.getElementsByTagName("option");
    let address;
    for (let i = 0; i < optionlist.length; i++) {
        if (optionlist[i].selected == true) {
            address = optionlist[i].value;
        }
    }
    // 获取备注
    let remark = document.getElementById("beizhu").value;
    let date = document.getElementById("date").value;

    // 调用Ajax请求
    let add = postAjax("http://localhost:3008/api/student/addStudent", `clazz=${clazz}&name=${name}&gender=${gender}&age=${age}&hobby=${hobby}&tel=${tel}&address=${remark}&remark=${beizhu}`);
    add.then((result) => {
        alert("添加成功");
    }).catch(() => {
        alert("添加失败");
    })


}